"""This is a wrapper for cube requests"""

from pypalo.basic import response, url, default, arguments

request_group="cube"

def clear(cube, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/clear[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		cube [identifier] <Identifier of a cube>
		area [area] <Comma separate list of element identifier lists. An identifier list is seperated by colons. The area is the cartesian product.>
		complete [boolean] <(Optional) If complete is "1" then the whole cube - regardless of the specified area - will be cleared. It is not necassary to even specify the parameter "area" in this case. Default is to use "area".>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 cube [identifier] Identifier of the cube
		1 name_cube [string] Name of the cube
		2 number_dimensions [integer] Number of dimensions
		3 dimensions [identifier] <Comma separate list of dimension identifiers>
		4 number_cells [integer] <Total number of cells>
		5 number_filled_cells [integer] <Number of filled numeric base cells plus number of filled string cells>
		6 status [integer] <Status of cube (0=unloaded, 1=loaded and 2=changed)>
		7 type [integer] <Type of cube (0=normal, 1=system, 2=attribute, 3=user info, 4=gpu type)>
		8 cube_token [integer] The cube token of the cube
	
	More info at http://host:port/api/cube/clear
	'''
	#beginning of function suite
	request_name="clear"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def commit(lock, cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/commit[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		cube [identifier] <Identifier of a cube>
		lock [integer] <Indentifier of the locked area>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/cube/commit
	'''
	#beginning of function suite
	request_name="commit"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def create(new_name, dimensions, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/create[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		new_name [string] <Name of the new cube>
		dimensions [identifier] <Comma separate list of dimension identifier>
		type [identifier] <Type of the dimension (0=normal (default), 3=user info)>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result:
		0 cube [identifier] <Identifier of the cube>
		1 name_cube [string] <Name of the cube>
		2 number_dimensions [integer] <Number of dimensions>
		3 dimensions [identifier] <Comma separate list of dimension identifiers>
		4 number_cells [integer] <Total number of cells>
		5 number_filled_cells [integer] <Number of filled numeric base cells plus number of filled string cells>
		6 status [integer] <Status of cube (0=unloaded, 1=loaded and 2=changed)>
		7 type [integer] <Type of cube (0=normal, 1=system, 2=attribute, 3=user info, 4=gpu type)>
		8 cube_token [integer] <The cube token of the cube>
	
	More info at http://host:port/api/cube/create
	'''
	#beginning of function suite
	request_name="create"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def destroy(cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/destroy[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		cube [identifier] <Identifier of a cube>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/cube/destroy
	'''
	#beginning of function suite
	request_name="destroy"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def info(cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/info[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		cube [identifier] <Identifier of a cube>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result:
		0 cube [identifier] <Identifier of the cube>
		1 name_cube [string] <Name of the cube>
		2 number_dimensions [integer] <Number of dimensions>
		3 dimensions [identifier] <Comma separate list of dimension identifiers>
		4 number_cells [integer] <Total number of cells>
		5 number_filled_cells [integer] <Number of filled numeric base cells plus number of filled string cells>
		6 status [integer] <Status of cube (0=unloaded, 1=loaded and 2=changed)>
		7 type [integer] <Type of cube (0=normal, 1=system, 2=attribute, 3=user info, 4=gpu type)>
		8 cube_token [integer] <The cube token of the cube>
	
	More info at http://host:port/api/cube/info
	'''
	#beginning of function suite
	request_name="info"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def load(cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/load[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		cube [identifier] <Identifier of a cube>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/cube/load
	'''
	#beginning of function suite
	request_name="load"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def lock(area, cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/lock[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		cube [identifier] <Identifier of a cube>
		area [area] <Comma separate list of element identifier lists. An identifier list is seperated by colons. The area is the cartesian product.>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 lock [integer] <Indentifier of the locked area>
		1 area [area] <Comma separated list of element identifiers list. Each element identifiers list is colon separated. The area is the cartesian product.>
		2 user [string] <The name of the user who locked the cube>
		3 [steps] integer <Number of steps>
	
	More info at http://host:port/api/cube/lock
	'''
	#beginning of function suite
	request_name="lock"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def locks(cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/locks[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		cube [identifier] <Identifier of a cube>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 lock [integer] <Indentifier of the locked area>
		1 area [area] <Comma separated list of element identifiers list. Each element identifiers list is colon separated. The area is the cartesian product.>
		2 user [string] <The name of the user who locked the cube>
		3 [steps] integer <Number of steps>
	
	More info at http://host:port/api/cube/locks
	'''
	#beginning of function suite
	request_name="locks"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def rename(new_name, cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/rename[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		cube [identifier] <Identifier of a cube>
		new_name [string] <Name of the new cube>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result:
		0 cube [identifier] <Identifier of the cube>
		1 name_cube [string] <Name of the cube>
		2 number_dimensions [integer] <Number of dimensions>
		3 dimensions [identifier] <Comma separate list of dimension identifiers>
		4 number_cells [integer] <Total number of cells>
		5 number_filled_cells [integer] <Number of filled numeric base cells plus number of filled string cells>
		6 status [integer] <Status of cube (0=unloaded, 1=loaded and 2=changed)>
		7 type [integer] <Type of cube (0=normal, 1=system, 2=attribute, 3=user info, 4=gpu type)>
		8 cube_token [integer] <The cube token of the cube>
	
	More info at http://host:port/api/cube/rename
	'''
	#beginning of function suite
	request_name="rename"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def rollback(lock, steps, cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/rollback[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		cube [identifier] <Identifier of a cube>
		lock [integer] <Indentifier of the locked area>
		steps [integer] <number of steps to rollback (an empty value means undo all steps and remove lock)>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/cube/rollback
	'''
	#beginning of function suite
	request_name="rollback"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def rules(use_identifier, cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/rules[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		cube [identifier] <Identifier of a cube>
		use_identifier [boolean] <Use identifier in textual representation of the rule>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 rule [identifier] <Identifier of the rule>
		1 rule_string [string] <Textual representation for the rule>
		2 external_identifier [string] <external identifier of the rule>
		3 comment [string] <comment for the rule>
		4 timestamp [string] <creation time of the rule in seconds since 1970-01-01>
		5 active [integer] <0=rule is not active, 1=rule is active>
	
	More info at http://host:port/api/cube/rules
	'''
	#beginning of function suite
	request_name="rules"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def save(cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/save[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		cube [identifier] <Identifier of a cube>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/cube/save
	'''
	#beginning of function suite
	request_name="save"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def unload(cube, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/cube/unload[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		cube [identifier] <Identifier of a cube>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/cube/unload
	'''
	#beginning of function suite
	request_name="unload"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

#querys dictionary

query={}
query["clear"]=clear
query["commit"]=commit
query["create"]=create
query["destroy"]=destroy
query["info"]=info
query["load"]=load
query["lock"]=lock
query["locks"]=locks
query["rename"]=rename
query["rollback"]=rollback
query["rules"]=rules
query["save"]=save
query["unload"]=unload

#end of cube module suite